import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 用户优惠券
 */
@Entity('coupon_user')
export class CouponUserEntity extends BaseEntity {
  @Index()
  @Column({ comment: '优惠券ID' })
  couponId: number;

  @Index()
  @Column({ comment: '用户ID' })
  userId: number;

  @Column({ comment: '领取时间' })
  receiveTime: Date;

  @Index()
  @Column({
    comment: '使用状态',
    dict: ['未使用', '已使用', '已过期'],
    default: 0,
  })
  status: number;

  @Column({ comment: '使用时间', nullable: true })
  useTime: Date;

  @Column({ comment: '订单编号', nullable: true })
  orderNo: string;
}
